\(\int (A+B x) \sqrt {a^2+2 a b x+b^2 x^2} \, dx\) [657]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [C] (warning: unable to verify)
   Fricas [A] (verification not implemented)
   Sympy [A] (verification not implemented)
   Maxima [B] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 26, antiderivative size = 69 \[ \int (A+B x) \sqrt {a^2+2 a b x+b^2 x^2} \, dx=\frac {(A b-a B) (a+b x) \sqrt {a^2+2 a b x+b^2 x^2}}{2 b^2}+\frac {B \left (a^2+2 a b x+b^2 x^2\right )^{3/2}}{3 b^2} \]

[Out]

1/3*B*(b^2*x^2+2*a*b*x+a^2)^(3/2)/b^2+1/2*(A*b-B*a)*(b*x+a)*((b*x+a)^2)^(1/2)/b^2

Rubi [A] (verified)

Time = 0.01 (sec) , antiderivative size = 69, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.077, Rules used = {654, 623} \[ \int (A+B x) \sqrt {a^2+2 a b x+b^2 x^2} \, dx=\frac {(a+b x) \sqrt {a^2+2 a b x+b^2 x^2} (A b-a B)}{2 b^2}+\frac {B \left (a^2+2 a b x+b^2 x^2\right )^{3/2}}{3 b^2} \]

[In]

Int[(A + B*x)*Sqrt[a^2 + 2*a*b*x + b^2*x^2],x]

[Out]

((A*b - a*B)*(a + b*x)*Sqrt[a^2 + 2*a*b*x + b^2*x^2])/(2*b^2) + (B*(a^2 + 2*a*b*x + b^2*x^2)^(3/2))/(3*b^2)

Rule 623

Int[((a_) + (b_.)*(x_) + (c_.)*(x_)^2)^(p_), x_Symbol] :> Simp[(b + 2*c*x)*((a + b*x + c*x^2)^p/(2*c*(2*p + 1)
)), x] /; FreeQ[{a, b, c, p}, x] && EqQ[b^2 - 4*a*c, 0] && NeQ[p, -2^(-1)]

Rule 654

Int[((d_.) + (e_.)*(x_))*((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(p_), x_Symbol] :> Simp[e*((a + b*x + c*x^2)^(p +
 1)/(2*c*(p + 1))), x] + Dist[(2*c*d - b*e)/(2*c), Int[(a + b*x + c*x^2)^p, x], x] /; FreeQ[{a, b, c, d, e, p}
, x] && NeQ[2*c*d - b*e, 0] && NeQ[p, -1]

Rubi steps \begin{align*} \text {integral}& = \frac {B \left (a^2+2 a b x+b^2 x^2\right )^{3/2}}{3 b^2}+\frac {\left (2 A b^2-2 a b B\right ) \int \sqrt {a^2+2 a b x+b^2 x^2} \, dx}{2 b^2} \\ & = \frac {(A b-a B) (a+b x) \sqrt {a^2+2 a b x+b^2 x^2}}{2 b^2}+\frac {B \left (a^2+2 a b x+b^2 x^2\right )^{3/2}}{3 b^2} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.58 (sec) , antiderivative size = 91, normalized size of antiderivative = 1.32 \[ \int (A+B x) \sqrt {a^2+2 a b x+b^2 x^2} \, dx=\frac {x (3 a (2 A+B x)+b x (3 A+2 B x)) \left (\sqrt {a^2} b x+a \left (\sqrt {a^2}-\sqrt {(a+b x)^2}\right )\right )}{-6 a^2-6 a b x+6 \sqrt {a^2} \sqrt {(a+b x)^2}} \]

[In]

Integrate[(A + B*x)*Sqrt[a^2 + 2*a*b*x + b^2*x^2],x]

[Out]

(x*(3*a*(2*A + B*x) + b*x*(3*A + 2*B*x))*(Sqrt[a^2]*b*x + a*(Sqrt[a^2] - Sqrt[(a + b*x)^2])))/(-6*a^2 - 6*a*b*
x + 6*Sqrt[a^2]*Sqrt[(a + b*x)^2])

Maple [C] (warning: unable to verify)

Result contains higher order function than in optimal. Order 9 vs. order 2.

Time = 0.09 (sec) , antiderivative size = 33, normalized size of antiderivative = 0.48

method result size
default \(\frac {\operatorname {csgn}\left (b x +a \right ) \left (b x +a \right )^{2} \left (2 B b x +3 A b -B a \right )}{6 b^{2}}\) \(33\)
gosper \(\frac {x \left (2 B b \,x^{2}+3 A b x +3 a B x +6 a A \right ) \sqrt {\left (b x +a \right )^{2}}}{6 b x +6 a}\) \(42\)
risch \(\frac {\sqrt {\left (b x +a \right )^{2}}\, B b \,x^{3}}{3 b x +3 a}+\frac {\sqrt {\left (b x +a \right )^{2}}\, \left (A b +B a \right ) x^{2}}{2 b x +2 a}+\frac {\sqrt {\left (b x +a \right )^{2}}\, a A x}{b x +a}\) \(73\)

[In]

int((B*x+A)*((b*x+a)^2)^(1/2),x,method=_RETURNVERBOSE)

[Out]

1/6*csgn(b*x+a)*(b*x+a)^2*(2*B*b*x+3*A*b-B*a)/b^2

Fricas [A] (verification not implemented)

none

Time = 0.27 (sec) , antiderivative size = 24, normalized size of antiderivative = 0.35 \[ \int (A+B x) \sqrt {a^2+2 a b x+b^2 x^2} \, dx=\frac {1}{3} \, B b x^{3} + A a x + \frac {1}{2} \, {\left (B a + A b\right )} x^{2} \]

[In]

integrate((B*x+A)*((b*x+a)^2)^(1/2),x, algorithm="fricas")

[Out]

1/3*B*b*x^3 + A*a*x + 1/2*(B*a + A*b)*x^2

Sympy [A] (verification not implemented)

Time = 1.08 (sec) , antiderivative size = 156, normalized size of antiderivative = 2.26 \[ \int (A+B x) \sqrt {a^2+2 a b x+b^2 x^2} \, dx=A \left (\begin {cases} \left (\frac {a}{2 b} + \frac {x}{2}\right ) \sqrt {a^{2} + 2 a b x + b^{2} x^{2}} & \text {for}\: b^{2} \neq 0 \\\frac {\left (a^{2} + 2 a b x\right )^{\frac {3}{2}}}{3 a b} & \text {for}\: a b \neq 0 \\x \sqrt {a^{2}} & \text {otherwise} \end {cases}\right ) + B \left (\begin {cases} \sqrt {a^{2} + 2 a b x + b^{2} x^{2}} \left (- \frac {a^{2}}{6 b^{2}} + \frac {a x}{6 b} + \frac {x^{2}}{3}\right ) & \text {for}\: b^{2} \neq 0 \\\frac {- \frac {a^{2} \left (a^{2} + 2 a b x\right )^{\frac {3}{2}}}{3} + \frac {\left (a^{2} + 2 a b x\right )^{\frac {5}{2}}}{5}}{2 a^{2} b^{2}} & \text {for}\: a b \neq 0 \\\frac {x^{2} \sqrt {a^{2}}}{2} & \text {otherwise} \end {cases}\right ) \]

[In]

integrate((B*x+A)*((b*x+a)**2)**(1/2),x)

[Out]

A*Piecewise(((a/(2*b) + x/2)*sqrt(a**2 + 2*a*b*x + b**2*x**2), Ne(b**2, 0)), ((a**2 + 2*a*b*x)**(3/2)/(3*a*b),
 Ne(a*b, 0)), (x*sqrt(a**2), True)) + B*Piecewise((sqrt(a**2 + 2*a*b*x + b**2*x**2)*(-a**2/(6*b**2) + a*x/(6*b
) + x**2/3), Ne(b**2, 0)), ((-a**2*(a**2 + 2*a*b*x)**(3/2)/3 + (a**2 + 2*a*b*x)**(5/2)/5)/(2*a**2*b**2), Ne(a*
b, 0)), (x**2*sqrt(a**2)/2, True))

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 125 vs. \(2 (52) = 104\).

Time = 0.23 (sec) , antiderivative size = 125, normalized size of antiderivative = 1.81 \[ \int (A+B x) \sqrt {a^2+2 a b x+b^2 x^2} \, dx=\frac {1}{2} \, \sqrt {b^{2} x^{2} + 2 \, a b x + a^{2}} A x - \frac {\sqrt {b^{2} x^{2} + 2 \, a b x + a^{2}} B a x}{2 \, b} - \frac {\sqrt {b^{2} x^{2} + 2 \, a b x + a^{2}} B a^{2}}{2 \, b^{2}} + \frac {\sqrt {b^{2} x^{2} + 2 \, a b x + a^{2}} A a}{2 \, b} + \frac {{\left (b^{2} x^{2} + 2 \, a b x + a^{2}\right )}^{\frac {3}{2}} B}{3 \, b^{2}} \]

[In]

integrate((B*x+A)*((b*x+a)^2)^(1/2),x, algorithm="maxima")

[Out]

1/2*sqrt(b^2*x^2 + 2*a*b*x + a^2)*A*x - 1/2*sqrt(b^2*x^2 + 2*a*b*x + a^2)*B*a*x/b - 1/2*sqrt(b^2*x^2 + 2*a*b*x
 + a^2)*B*a^2/b^2 + 1/2*sqrt(b^2*x^2 + 2*a*b*x + a^2)*A*a/b + 1/3*(b^2*x^2 + 2*a*b*x + a^2)^(3/2)*B/b^2

Giac [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 74, normalized size of antiderivative = 1.07 \[ \int (A+B x) \sqrt {a^2+2 a b x+b^2 x^2} \, dx=\frac {1}{3} \, B b x^{3} \mathrm {sgn}\left (b x + a\right ) + \frac {1}{2} \, B a x^{2} \mathrm {sgn}\left (b x + a\right ) + \frac {1}{2} \, A b x^{2} \mathrm {sgn}\left (b x + a\right ) + A a x \mathrm {sgn}\left (b x + a\right ) - \frac {{\left (B a^{3} - 3 \, A a^{2} b\right )} \mathrm {sgn}\left (b x + a\right )}{6 \, b^{2}} \]

[In]

integrate((B*x+A)*((b*x+a)^2)^(1/2),x, algorithm="giac")

[Out]

1/3*B*b*x^3*sgn(b*x + a) + 1/2*B*a*x^2*sgn(b*x + a) + 1/2*A*b*x^2*sgn(b*x + a) + A*a*x*sgn(b*x + a) - 1/6*(B*a
^3 - 3*A*a^2*b)*sgn(b*x + a)/b^2

Mupad [B] (verification not implemented)

Time = 10.14 (sec) , antiderivative size = 77, normalized size of antiderivative = 1.12 \[ \int (A+B x) \sqrt {a^2+2 a b x+b^2 x^2} \, dx=\frac {A\,\sqrt {{\left (a+b\,x\right )}^2}\,\left (a+b\,x\right )}{2\,b}+\frac {B\,\left (8\,b^2\,\left (a^2+b^2\,x^2\right )-12\,a^2\,b^2+4\,a\,b^3\,x\right )\,\sqrt {a^2+2\,a\,b\,x+b^2\,x^2}}{24\,b^4} \]

[In]

int(((a + b*x)^2)^(1/2)*(A + B*x),x)

[Out]

(A*((a + b*x)^2)^(1/2)*(a + b*x))/(2*b) + (B*(8*b^2*(a^2 + b^2*x^2) - 12*a^2*b^2 + 4*a*b^3*x)*(a^2 + b^2*x^2 +
 2*a*b*x)^(1/2))/(24*b^4)